package com.sofa.shark.admin.api.fegin.factory;

import com.alipay.sofa.rpc.hystrix.FallbackContext;
import com.alipay.sofa.rpc.hystrix.FallbackFactory;
import com.sofa.shark.admin.api.fegin.RemoteLogService;
import com.sofa.shark.admin.api.fegin.fallback.RemoteLogServiceFallbackImpl;
import org.springframework.stereotype.Component;

/**
 * @author tonyp
 */
@Component
public class RemoteLogServiceFallbackFactory implements FallbackFactory<RemoteLogService> {

    @Override
    public RemoteLogService create(FallbackContext fallbackContext) {
        RemoteLogServiceFallbackImpl remoteLogServiceFallback = new RemoteLogServiceFallbackImpl();
        remoteLogServiceFallback.setCause(fallbackContext.getException());
        return remoteLogServiceFallback;
    }

}
